Skip to content

Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | coursework #1439

Open
meneogbemi42-bit wants to merge 19 commits into
CodeYourFuture:mainfrom
meneogbemi42-bit:coursework/sprint2
Open

Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | coursework #1439
meneogbemi42-bit wants to merge 19 commits into
CodeYourFuture:mainfrom
meneogbemi42-bit:coursework/sprint2

Conversation

@meneogbemi42-bit

@meneogbemi42-bit meneogbemi42-bit commented Jul 2, 2026

Copy link
Copy Markdown
  • [ x ] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • [ x ] My changes meet the requirements of the task
  • [ x ] I have tested my changes
  • [ x ] My changes follow the style guide

This PR contains debugging, implementation, and interpretation work across multiple coding exercises focusing on function parameters, return values, and string manipulation in JavaScript.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added 🏕 Priority Mandatory This work is expected Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 2, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit changed the title Birmingham Coursework/sprint2 Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | Coursework/sprint2 Jul 2, 2026
@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@Liam310 Liam310 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 6, 2026

return `${str[0].toUpperCase()}${str.slice(1)}`;

}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good explanation of scope and variable declarations here, just wanted to highlight the extra if statement you added. Are you sure it handles the empty string case like you describe?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the best explanation i could come up with.

By checking typeof str !== "string", you are asking: "If the input is anything other than a string, stop processing and just return the input exactly as it is." If you send a string: It skips the if block and proceeds to do the work.
If you send a number: The if condition is true, so it returns the number and ignores the rest of the function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So your understanding of what the if statement does (as you've explained here) is good, but that's not what you've said in the comments 🙂 You said:

the if condition i added is to ensure that if an empty string is passed to the function, it will return the empty string instead of throwing an error.

But as you have described, the if condition checks for the data type, not whether the string is empty. How would you check for that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the initial statement was not correct, i looked at it critically a saw that this if statement will trow an error, because i did not add this ( | | ) operator, Because of the | | operator, if the string is empty, the function returns str. to handle it i will add || str.length === 0) to the if condition. and this will handle it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this second condition then 🙂

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there Ogbemi - just make sure to add this condition and then I'm happy to mark as complete!

Comment thread Sprint-2/2-mandatory-debug/1.js Outdated
Comment thread Sprint-2/3-mandatory-implement/3-to-pounds.js
Comment thread Sprint-2/5-stretch-extend/format-time.js Outdated
@Liam310

Liam310 commented Jul 6, 2026

Copy link
Copy Markdown

Really nice explanations Ogbemi! Just a few comments but good work overall.

@Liam310 Liam310 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 7, 2026
@meneogbemi42-bit meneogbemi42-bit added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 7, 2026
@Liam310 Liam310 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 10, 2026
@meneogbemi42-bit meneogbemi42-bit added 🏕 Priority Mandatory This work is expected Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 10, 2026
@Liam310 Liam310 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 10, 2026
Moved the return statement to after the addition operation to ensure the function returns the correct result.
@meneogbemi42-bit meneogbemi42-bit added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 10, 2026
@Liam310 Liam310 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 14, 2026
Updated the capitalise function to handle empty strings.
@meneogbemi42-bit meneogbemi42-bit added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants